from google.appengine.ext import db
from google.appengine.api import users

class Community(db.Model):
    """What speciallist category within or without nations does the Mod belong to? 'none' if none.
    This should reflect user needs and preferences rather than environment aspects, such as technology used"""
    name=db.StringProperty(default="")
    desc=db.StringProperty(default="")  

class Nation(db.Model):
    """Large user grouping, where many users are, for example, using the same User Agent/browser
    """
    name = db.StringProperty(default="")
    desc = db.StringProperty(default="")
    
class Mod(db.Model):
  """script used to modify a site, based on specific constraints regarding the user, user's choosen settings, site, and environment"""
  name = db.StringProperty()
  description = db.StringProperty()
  owner = db.UserProperty()
  isGlobal = db.BooleanProperty()
  nation = Nation(name="", desc="")
  community = Community(name="", desc="")
  postParse = db.BooleanProperty()
  type = db.StringProperty()
  text = db.TextProperty()
  user = db.UserProperty()
  paramURL = db.URLProperty()
  specDomain = db.URLProperty()
  ratified = db.BooleanProperty()
  
class GlobalModMap(db.Model):
    """Used to save user mod preferences. There should only ever be one ModMap per user"""
    user = db.UserProperty()
    globalblacklist = db.StringListProperty()
    globalmodlist = db.StringListProperty()


class DomSpecModMap(db.Model):
    """Used to save user mod preferences. There should only ever be one ModMap per user per domain (indicated by currentURL)"""
    user = db.UserProperty()
    currentURL = db.StringProperty()
    domSpecMods = db.StringListProperty()
    domSpecBlacklist = db.StringListProperty()    
    
    
  
class ScriptMod(Mod):
    isDynode = db.BooleanProperty()
    isInline = db.BooleanProperty()
    scritpType = db.StringProperty()
    
class HTMLMod(Mod):
    element = db.StringProperty()
    
class replaceMod(Mod):
    replaceAll = db.BooleanProperty(default=False)
    
class redirectMod(Mod):
    sendDataMethod = db.StringProperty()
    




